<?
include("../common/auth.php");
$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$s = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
switch($_REQUEST['action']){
	case "getOtherProduct":
		$lid=abs($_REQUEST['lid']);
		$pid=abs($_REQUEST['pid']);
		$id=abs($_REQUEST['id']);
		$str="select p.id,t.title,b.dprice from uu_products p join uu_jq_ticket t on t.pid=p.id join uu_priceset b on b.tid=p.id where b.pid=$pid and b.num>0 and p.p_status in (0,3,4,5) and p.contact_id=$lid and p.id<>$id";
		$GLOBALS['le']->query($str);
		$c_infos=array();
		while($row=$GLOBALS['le']->fetch_assoc()){
			$c_jsprice=$s->get_Dynamic_Price_Merge($row['id'],$begintime,1);
			if($c_jsprice!=-1){
				$c_infos[]=array("pid"=>$row['id'],"title"=>$row['title'],"tprice"=>($row['dprice']+$c_jsprice));
			}
		}
		if(count($c_infos)==0)
			echo -1;
		else 
			echo json_decode($c_infos);
		break;
	case "getRoomStorage":
		$tid=abs($_REQUEST['tid']);
		$storageDate=$_REQUEST['storageDate'];
		$storageXml=$s->Dynamic_Storage_Check($tid,1,$storageDate);
		$storageXml=simplexml_load_string($storageXml);
		$storageXml=$storageXml->Rec->UUXstr;
		$storageXml=explode(",",$storageXml);
		$dstorage=array();
		foreach($storageXml as $row){
			$array=explode("|",$row);
			$dstorage[$array[0]]=$array[1];
		}
		echo json_encode($dstorage);
	break;
	default:
		break;
}
?>